import struct

with open("binary.txt", 'wb') as file:
	for x in range(1, 101):
		file.write(struct.pack("i", x))

# 计算int类型字段长度
size = struct.calcsize("i")
with open('binary.txt', 'rb') as file:
	bytes_read = file.read(size)
	while bytes_read:
		value = struct.unpack("i", bytes_read)
		# 读出来的是个tuple，很奇怪
		print(type(value))
		print(value[0], end=" ")
		bytes_read = file.read(size)

	